﻿<%@ Page Language="C#" Title="路段划分页面" MasterPageFile="~/W_View/PageMaster.Master" CodeBehind="B_RdstandardPage.aspx.cs" Inherits="STHPMS1.Web.W_View.Decision.B_RdstandardPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <%= UiHelper.RefJsFileHtml("/Scripts/Control/datagrid.js")%>
     <%= UiHelper.RefJsFileHtml("/Scripts/Jquery/ajaxfileupload.js")%>
    <%= UiHelper.RefJsFileHtml("/Scripts/TypeScript/Enum.js")%>
    <%= UiHelper.RefJsFileHtml("/Scripts/TypeScript/JsPage.js")%>
    <%= UiHelper.RefJsFileHtml("/Scripts/TypeScript/Appearance.js")%>
    <%= UiHelper.RefJsFileHtml("/Scripts/TypeScript/Bussiness.js")%>

    <script>
        //导入的点击事件
        function impt() {
            $("#linkUpload").text("上传");

            $('#dlgImport').dialog('open');
        }

        function closeFile() {
            $("#linkUpload").text("上传");
            $('#dlgImport').dialog('close');
            $("#fileHid").val('');//清空隐藏域
        }
        //上传
        function ajaxFileUpload() {
            $.ajaxFileUpload
            (
                {
                    url: '/api/rdstandard/uploadFile', //用于文件上传的服务器端请求地址
                    secureuri: false, //是否需要安全协议，一般设置为false
                    fileElementId: 'file1', //文件上传域的ID
                    dataType: 'string', //返回值类型 一般设置为json
                    success: function (data)  //服务器成功响应处理函数
                    {
                        var file = data.replace('<pre>', '').replace('</pre>', '');
                        //写入隐藏域
                        $("#fileHid").val(file);
                        $("#linkUpload").text("上传成功");
                    },
                    error: function (data, status, e)//服务器响应失败处理函数
                    {
                        alert(e);

                    }
                }
            )
            return false;
        }
        //上传文件验证
        function upLoad() {
            if ($("#linkUpload").text() == "上传") {
                var file = $("#file1").val();//上传文件
                if (file == "") {
                    alert("请选择上传数据");
                    return;
                }
                else {
                    var extStart = file.lastIndexOf(".");
                    var ext = file.substring(extStart, file.length).toUpperCase();
                    if (ext != ".XLS" && ext != ".XLSX") {
                        alert("请上传有效Excel文件");
                        return;
                    }
                }
                ajaxFileUpload();
            }
        }
        //导入处理
        function saveFile() {
            var file = $("#fileHid").val();//上传后的Excel路径
            if (file == "") {
                alert("请上传数据文件");
                return;
            }
            $.messager.progress({
                title: '请等待',
                msg: '正在处理中...'
            });

            $.ajax({
                url: "/api/rdstandard/saveFile?file=" + encodeURI(file),
                type: "post",
                success: function (msg) {
                    $("#fileHid").val('');//清空隐藏域
                    $('#dlgImport').dialog('close');
                    $.messager.progress('close');
                    _view.loadDataGrid();
                },

                error: function (msg) {
                    //错误处理
                    alert(msg.responseText);
                    closeFile();
                }
            });
        }

    </script>

    <script type="text/javascript">
        $.extend($.fn.datagrid.methods, {
            editCell: function (jq, param) {
                return jq.each(function () {
                    var opts = $(this).datagrid('options');
                    var arr = param.field.split(',');

                    var fields = $(this).datagrid('getColumnFields', true).concat($(this).datagrid('getColumnFields'));
                    for (var i = 0; i < fields.length; i++) {
                        var col = $(this).datagrid('getColumnOption', fields[i]);
                        col.editor1 = col.editor;

                        var flag = true;
                        for (var item in arr)
                        {
                            if (fields[i] == arr[item]) {
                                flag = false;
                                break;
                            }
                        }

                        if (flag) col.editor = null;
                    }

                    $(this).datagrid('beginEdit', param.index);
                });
            }
        });

        var _view = new JsPage();
        var _css = new Appearance();
        var _bus = new Bussiness();

        function onEditClick()
        {
            _view.AddAction();        
        }

        function onDelClick() {
            var rdwayid=$('#cmbRdwayid').combobox('getValue');
             $.ajax({
                    type: "Delete",
                    url: '/api/rdstandard',
                    data:{
                        Rdwayid:rdwayid
                    },
                    success: function (codes) {
                        $('#dg').datagrid('reload');
                    },
                    error: Common.ShowError
                });
        }

        function onSumbitClick() {
            if (_standards)
            {
                for (var key in _standards) {
                    var e = parseInt(key.replace("R", ""));
                    var name = formatEnum(e);
                    if (!_standards[key])
                    {
                        $.messager.alert('错误提示', name + "没有数据", "error");
                        return;
                    }

                    for (var i = 0; i < _standards[key].data.length - 1; i++) {
                        if (key == "R207") continue;
                        var value = _standards[key].data[i].Value;
                        if (value == undefined || value == "")
                        {
                            $("#cmbChangetype_Dictid").combobox("select", e);
                            $.messager.alert('错误提示', name + "-起点桩号：" + _standards[key].data[i].Beginmp + " 没有数据", "error");
                            return;
                        }
                    }
                }

                $.messager.progress({
                    title: '请等待',
                    msg: '正在处理中...'
                });
                $.ajax({
                    type: 'post',
                    async: false,
                    url: '/api/rdstandard',
                    data:
                    {
                        rdwayid: $('#cmbRdwayid').combobox('getValue'),
                        data: JSON.stringify(_standards) 
                    },
                    complete: function () {
                        $.messager.progress('close');
                    },
                    success: function (codes) {
                        onCloseClick();
                        $('#dg').datagrid('reload');
                    },
                    error: Common.ShowError
                });
            } else
            {
                $.messager.alert('错误提示', '没有可以保存的数据!', "error");
            }
        }
        function onCloseClick() {
            _view.closeDialog();
        }


        $(function () {
            $("#btnImpt").on("click", impt);
            $("#btnUpload").on("click", saveFile);
            $("#btnQuit").on("click", closeFile);

            $("#btnEdit").on("click", onEditClick);
            $("#btnDel").on("click", onDelClick);
            $("#btnSave").on("click", onSumbitClick);
            $("#btnCancel").on("click", onCloseClick);
            $("#btnAdd").on("click", onAddClick);
            $("#btnRemove").on("click", onRemoveClick);
            $("#cmbChangetype_Dictid").combobox({ onSelect: change_standard });

            _view.setDialog($('#dlg'))
                .setDataGrid($('#dg'))
                .loadDataGrid("/api/rdstandard");

            var data = EnumEx.getDicts(RdStandardTypeEnum, function (item) {
                if (item == RdStandardTypeEnum.R200 || item == RdStandardTypeEnum.R201)
                    return false;
                return true;
            });
            $('#cmbChangetype_Dictid').combobox('loadData', data);

            $.ajax({
                type: 'get',
                async: true,
                url: '/api/data/code',
                success: function (codes) {
                    _codes = codes;
                },
                error: Common.ShowError
            });
        })

        function change_standard(record) {
            if (!record) return;
            if (_dg && editIndex) _dg.datagrid('endEdit', editIndex);

            var field = "R" + record.id;
            showStakes($("#" + field), _standards[field].data);
        }
        
        function onClickCell(index,field,value)
        {
            var row = $('#dg').datagrid('getRows')[index];
            if (row) {
                ///加载路线
                $('#cmbRdwayid').combobox('setValue', row.Rdwayid);
                ///加载方向
                var record = null
                var data = $('#cmbRdwayid').combobox('getData');
                data.forEach(function (element, index, array) {
                    if (element.Rdwayid == row.Rdwayid) {
                        record = element;
                        return false;
                    }
                    return true;
                });
                ///加载划分标准
                var value = 202;
                if (field === "R203") value = 203;
                else if (field === "R204") value = 204;
                else if (field === "R205") value = 205;
                else if (field === "R206") value = 206;
                else if (field === "R207") value = 207;
                else if (field === "R208") value = 208;
                else if (field === "R209") value = 209;
                else if (field === "R210") value = 210;
                else if (field === "R211") value = 211;
                else field = "R202";
                $('#cmbChangetype_Dictid').combobox('setValue', value);
                ///加载划分标准桩号
                loadStakes(record, field);
            }
        }

        function loadStakes(record,field)
        {            
            $.ajax({
                type: 'get',
                async: false,
                url: '/api/rdstandard/detail',
                cache: false,
                data:
                {
                    rdwayid: $('#cmbRdwayid').combobox('getValue')
                },
                success: function (standard) {
                    _standards = standard;
                    showStakes($("#" + field), _standards[field].data);
                },
                error: Common.ShowError
            });           
        }

        function showStakes(dg, standard) {
            if (standard.length < 2) return;
            var data = [];
            for (var i = 1; i < standard.length; i++) {
                data[i - 1] = {};
                data[i - 1].Beginmp = standard[i - 1].Beginmp;
                data[i - 1].Endmp = standard[i].Beginmp;
                data[i - 1].Value = standard[i - 1].Value;                             
            }
            

            showDatagrid(dg).datagrid("loadData", data);

        }

        function showDatagrid(dg) {
            if (_dg)
            {
                _dg.datagrid({
                    closed: true

                });
            }

            dg.datagrid({
                toolbar: "#tb1",
                closed: false

            })
            _dg = dg;
            editIndex = undefined;
            return dg;
        }        
        
    </script>  
    
    <script type="text/javascript">
        /**行政区域编码**/
        var _codes;
        /**当前显示datagrid**/
        var _dg;
        /**当前编辑行**/
        var editIndex = undefined;
        /**划分标准数据**/
        var _standards = {
            R202: {},
            R203: {},
            R204: {},
            R205: {},
            R206: {},
            R207: {},
            R208: {},
            R209: {},
            R210: {},
            R211: {}
        };

        function onAddClick() {
            var beginmp = $("#Beginmp").numberbox("getValue");
            if (!beginmp) {
                $.messager.alert('错误提示', '请输入分段桩号', "error");
                return;
            }
            var type = $('#cmbChangetype_Dictid').combobox('getValue');
            if (!type) {
                $.messager.alert('错误提示', '请选择划分标准类型!', "error");
                return;
            }

            var id = "R" + type;
            var standard = _standards[id];
            beginmp = Number(beginmp);

            if (beginmp < standard.data[0].Beginmp) {
                $.messager.alert('错误提示', '桩号小于路线起点桩号!', "error");
                return;
            }
            if (beginmp > standard.data[standard.data.length - 1].Beginmp) {
                $.messager.alert('错误提示', '桩号大于路线终点桩号!', "error");
                return;
            }

            var flag = true;
            for (var i = 0; i < standard.data.length; i++) {
                if (standard.data[i].Beginmp == beginmp) {
                    flag = false;
                    break;
                }
            }

            if (flag) {
                standard.data.push({
                    Beginmp: beginmp,
                    Value: ""
                });
                standard.data.sort(function (a, b) {
                    if (a.Beginmp < b.Beginmp)
                        return -1;
                    if (a.Beginmp > b.Beginmp)
                        return 1;
                    return 0;
                });


                showStakes($("#" + id), standard.data);
            }
            $("#Beginmp").numberbox("clear");
        }
        function onRemoveClick() {
            var beginmp = $("#Beginmp").numberbox("getValue");
            if (!beginmp) {
                $.messager.alert('错误提示', '请输入分段桩号', "error");
                return;
            }
            var type = $('#cmbChangetype_Dictid').combobox('getValue');
            if (!type) {
                $.messager.alert('错误提示', '请选择划分标准类型!', "error");
                return;
            }


            var id = "R" + type;
            var standard = _standards[id];
            beginmp = Number(beginmp);

            if (beginmp == standard.data[0].Beginmp) {
                $.messager.alert('错误提示', '路线起点桩号不允许删除!', "error");
                return;
            }
            if (beginmp == standard.data[standard.data.length - 1].Beginmp) {
                $.messager.alert('错误提示', '路线终点桩号不允许删除!', "error");
                return;
            }

            var index = -1;
            for (var i = 0; i < standard.data.length; i++) {
                if (standard.data[i].Beginmp == beginmp) {
                    index = i;
                    break;
                }
            }

            if (index > -1)
            {
                standard.data.splice(index, 1);
                showStakes($("#" + id), standard.data);
            }
            $("#Beginmp").numberbox("clear");
        }

        function endEditing(dg) {
            if (editIndex == undefined) { return true }
            if (dg.datagrid('validateRow', editIndex)) {

                dg.datagrid('endEdit', editIndex);
                editIndex = undefined;
                return true;
            } else {
                return false;
            }
        }

        function onClickRow1(index) {
            if (editIndex != index) {
                var dg = $(this);
                if (endEditing(dg))
                {
                    dg.datagrid('selectRow', index).datagrid('editCell', { index: index, field: "Value,BeginDate" });

                    editIndex = index;
                } else
                {
                    dg.datagrid('selectRow', editIndex);
                }
            }
        }
      </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">   
    
    <div id="tb">
        <a id="btnEdit"  href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-edit',plain:true" >编辑</a>    
        <a id="btnDel"  href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-remove',plain:true" >删除</a>    
         <a href="/down?type=hfbz" class="easyui-linkbutton" data-options="iconCls:'icon-remove',plain:true">模板下载</a>
        <a id="btnImpt" href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-redo',plain:true" >导入</a>
    </div>

    <div id="dlg-buttons">
		<a id="btnSave" href="javascript:void(0)" class="easyui-linkbutton" >保存</a>
		<a id="btnCancel" href="javascript:void(0)" class="easyui-linkbutton" >取消</a>
	</div>

    <div id="dlg-tools">   
        <select id="cmbRdwayid" class="easyui-combobox" style="width:100px" data-options="readonly:true,prompt:'路线名称',url:'/api/roadway/all',method:'get',valueField:'Rdwayid',textField:'Name',panelHeight:'auto'">
        </select>
        <select id="cmbChangetype_Dictid" class="easyui-combobox" style="width:100px" data-options="prompt:'划分标准',valueField:'id',textField:'text',panelHeight:'auto'">
        </select>                
    </div>

    <div id="dlg" class="easyui-dialog" title="设定路段划分标准" style="width:600px;height:500px;padding:10px"  data-options="
                closed:true,
				iconCls: 'icon-save',
                toolbar:'#dlg-tools',
				buttons: '#dlg-buttons'">
        
    <div id="tb1">
        <input id="Beginmp" name='Beginmp' class='easyui-numberbox' data-options="prompt:'分段桩号',min:0,precision:2,formatter:_css.formatStake,parser:_css.parserStake" />
		<a id="btnAdd" href="javascript:void(0)" class="easyui-linkbutton" >添加</a>
		<a id="btnRemove" href="javascript:void(0)" class="easyui-linkbutton" >删除</a>
	</div>
        <table id="R202" class="easyui-datagrid content-place" data-options='{
                             closed:true,
                             "title": "行政区域",
                              "width": "550px",
                              "height": "370px",
                              "nowrap": false,
                              "singleSelect": true,
                              "onClickRow":onClickRow1
                            }' >
                    <thead>
                        <tr>
                            <th data-options="field:'Beginmp',editor:'numberbox',width:120,align:'center',formatter:_css.formatStake">起点桩号</th>
                            <th data-options="field:'Endmp',editor:'numberbox',width:120,align:'center',formatter:_css.formatStake">终点桩号</th>
                            <th data-options="field:'Value',width:260,align:'center',
						        formatter:function(value,row)
                                {
                                    if(value=='')return value;

                                    if(_codes)
							            return _codes[value];
                                    else
                                        return value;
						        },
						        editor:
                                {
							        type:'combotree',
							        options:
                                    {
                                        prompt:'行政区域',
                                        valueField:'id',
                                        textField:'text',
                                        url: '/api/data/regioncode',
                                        method:'get',
                                        onSelect:function(rect) {
                                            if(editIndex ==undefined)return;

                                            _standards.R202.data[editIndex].Value = rect.id;
                                        },
                                        onLoadSuccess:function(rows) {
                                            if(editIndex ==undefined)return;

                                            var row = $('#R202').datagrid('getRows')[editIndex];
                                            if (row && row.id) {
                                                $(this).combotree('setValue', row.id);
                                            }
                                        }
							        }
                                } ">行政区域</th>
                        </tr>
                    </thead>
        </table>
         <table id="R203" class="easyui-datagrid content-place" data-options='{
                             closed:true,
                             "title": "管养单位",
                              "width": "550px",
                              "height": "370px",
                              "nowrap": false,
                              "singleSelect": true,
                              "onClickRow":onClickRow1
                            }' >
                    <thead>
                        <tr>
                            <th data-options="field:'Beginmp',editor:'numberbox',width:120,align:'center',formatter:_css.formatStake">起点桩号</th>
                            <th data-options="field:'Endmp',editor:'numberbox',width:120,align:'center',formatter:_css.formatStake">终点桩号</th>
                            <th data-options="field:'Value',width:250,align:'center',editor: {
							        type:'textbox',
							        options:
                                    {
                                        prompt:'管养单位',
                                        validType:'MaxLength[100]',
                                        onChange:  function (newValue, oldValue) {
                                            if(editIndex ==undefined)return;
                                            
                                            _standards.R203.data[editIndex].Value = newValue;
                                        }
							        }
                                }">管养单位</th>
                        </tr>
                    </thead>
        </table>
        <table id="R204" class="easyui-datagrid content-place" data-options='{
                             closed:true,
                             "title": "车道数",
                              "width": "550px",
                              "height": "370px",
                              "nowrap": false,
                              "singleSelect": true,
                              "onClickRow":onClickRow1
                            }' >
                    <thead>
                        <tr>
                            <th data-options="field:'Beginmp',editor:'numberbox',width:120,align:'center',formatter:_css.formatStake">起点桩号</th>
                            <th data-options="field:'Endmp',editor:'numberbox',width:120,align:'center',formatter:_css.formatStake">终点桩号</th>
                            <th data-options="field:'Value',width:260,align:'center',
						        editor:
                                {
							        type:'combobox',
							        options:
                                    {
                                        prompt:'车道数',
                                        valueField:'id',
                                        textField:'text',
                                        data:[{id: '1',text: '1'}
                                                ,{id: '2',text: '2'}
                                                ,{id: '3',text: '3'}
                                                ,{id: '4',text: '4'}
                                                ,{id: '5',text: '5'}
                                                ,{id: '6',text: '6'}],
                                        onSelect:function(rect) {
                                            if(editIndex ==undefined)return;

                                            _standards.R204.data[editIndex].Value = rect.id;
                                        },
                                        onLoadSuccess:function(rows) {
                                            if(editIndex ==undefined)return;

                                            var row = $('#R204').datagrid('getRows')[editIndex];
                                            if (row && row.id) {
                                                $(this).combobox('setValue', row.id);
                                            }
                                        }
							        }
                                } ">车道数</th>
                        </tr>
                    </thead>
        </table>
         <table id="R205" class="easyui-datagrid content-place" data-options='{
                             closed:true,
                             "title": "路面宽度",
                              "width": "550px",
                              "height": "370px",
                              "nowrap": false,
                              "singleSelect": true,
                              "onClickRow":onClickRow1
                            }' >
                    <thead>
                        <tr>
                            <th data-options="field:'Beginmp',editor:'numberbox',width:120,align:'center',formatter:_css.formatStake">起点桩号</th>
                            <th data-options="field:'Endmp',editor:'numberbox',width:120,align:'center',formatter:_css.formatStake">终点桩号</th>
                            <th data-options="field:'Value',width:250,align:'center',editor: {
							        type:'numberbox',
							        options:
                                    {
                                        prompt:'路面宽度',
                                        min:0,
                                        max:50,
                                        precision:2,
                                        onChange:  function (newValue, oldValue) {
                                            if(editIndex ==undefined)return;
                                            
                                            _standards.R205.data[editIndex].Value = newValue;
                                        }
							        }
                                }">路面宽度</th>
                        </tr>
                    </thead>
        </table>
        <table id="R206" class="easyui-datagrid content-place" data-options='{
                             closed:true,
                             "title": "土基类型",
                              "width": "550px",
                              "height": "370px",
                              "nowrap": false,
                              "singleSelect": true,
                              "onClickRow":onClickRow1
                            }' >
                    <thead>
                        <tr>
                            <th data-options="field:'Beginmp',editor:'numberbox',width:120,align:'center',formatter:_css.formatStake">起点桩号</th>
                            <th data-options="field:'Endmp',editor:'numberbox',width:120,align:'center',formatter:_css.formatStake">终点桩号</th>
                            <th data-options="field:'Value',width:260,align:'center', 
                                formatter:function(value,row)
                                {
                                    if(!isNaN(value))
                                    {
                                        return formatEnum(Number(value));
                                    }
                                    else
                                        return value;
						        },
						        editor:
                                {
							        type:'combobox',
							        options:
                                    {
                                        prompt:'土基类型',
                                        valueField:'id',
                                        textField:'text',
                                        url: '/api/data/subgrade',
                                        method:'get',
                                        onSelect:function(rect) {
                                            if(editIndex ==undefined)return;

                                            _standards.R206.data[editIndex].Value = rect.id;
                                        },
                                        onLoadSuccess:function(rows) {
                                            if(editIndex ==undefined)return;

                                            var row = $('#R206').datagrid('getRows')[editIndex];
                                            if (row && row.id) {
                                                $(this).combobox('setValue', row.id);
                                            }
                                        }
							        }
                                } ">土基类型</th>
                        </tr>
                    </thead>
        </table>
         <table id="R207" class="easyui-datagrid content-place" data-options='{
                             closed:true,
                             "title": "交通量",
                              "width": "550px",
                              "height": "370px",
                              "nowrap": false,
                              "singleSelect": true,
                              "onClickRow":onClickRow1
                            }' >
                    <thead>
                        <tr>
                            <th data-options="field:'Beginmp',editor:'numberbox',width:120,align:'center',formatter:_css.formatStake">起点桩号</th>
                            <th data-options="field:'Endmp',editor:'numberbox',width:120,align:'center',formatter:_css.formatStake">终点桩号</th>
                            <th data-options="field:'Value',width:120,align:'center',editor: {
							        type:'numberbox',
							        options:
                                    {
                                        prompt:'交通量',
                                        min:0,
                                        precision:0,
                                        onChange:  function (newValue, oldValue) {
                                            if(editIndex ==undefined)return;
                                            
                                            _standards.R207.data[editIndex].Value = newValue;
                                        }
							        }
                                }">交通量
                            </th>
                        </tr>
                    </thead>
        </table>
        <table id="R208" class="easyui-datagrid content-place" data-options='{
                             closed:true,
                             "title": "路肩类型",
                              "width": "550px",
                              "height": "370px",
                              "nowrap": false,
                              "singleSelect": true,
                              "onClickRow":onClickRow1
                            }' >
                    <thead>
                        <tr>
                            <th data-options="field:'Beginmp',editor:'numberbox',width:120,align:'center',formatter:_css.formatStake">起点桩号</th>
                            <th data-options="field:'Endmp',editor:'numberbox',width:120,align:'center',formatter:_css.formatStake">终点桩号</th>
                            <th data-options="field:'Value',width:260,align:'center', 
                                formatter:function(value,row)
                                {                                    
                                    if(!isNaN(value))
                                    {
                                        return formatEnum(Number(value));
                                    }
                                    else
                                        return value;
						        },
						        editor:
                                {
							        type:'combobox',
							        options:
                                    {
                                        prompt:'路肩类型',
                                        valueField:'id',
                                        textField:'text',
                                        url: '/api/data/shoulder',
                                        method:'get',
                                        onSelect:function(rect) {
                                            if(editIndex ==undefined)return;

                                            _standards.R208.data[editIndex].Value = rect.id;
                                        },
                                        onLoadSuccess:function(rows) {
                                            if(editIndex ==undefined)return;

                                            var row = $('#R208').datagrid('getRows')[editIndex];
                                            if (row && row.id) {
                                                $(this).combobox('setValue', row.id);
                                            }
                                        }
							        }
                                } ">路肩类型</th>
                        </tr>
                    </thead>
        </table>
        <table id="R209" class="easyui-datagrid content-place" data-options='{
                             closed:true,
                             "title": "通车时间",
                              "width": "550px",
                              "height": "370px",
                              "nowrap": false,
                              "singleSelect": true,
                              "onClickRow":onClickRow1
                            }' >
                    <thead>
                        <tr>
                            <th data-options="field:'Beginmp',editor:'numberbox',width:120,align:'center',formatter:_css.formatStake">起点桩号</th>
                            <th data-options="field:'Endmp',editor:'numberbox',width:120,align:'center',formatter:_css.formatStake">终点桩号</th>
                            <th data-options="field:'Value',width:130,align:'center',editor: {
							        type:'numberbox',
							        options:
                                    {
                                        prompt:'通车时间',
                                        min:1949,
                                        max:2100,
                                        precision:0,
                                        onChange:  function (newValue, oldValue) {
                                            if(editIndex ==undefined)return;
                                            
                                            _standards.R209.data[editIndex].Value = newValue;
                                        }
							        }
                                }">通车时间</th>
                        </tr>
                    </thead>
        </table>
        <table id="R210" class="easyui-datagrid content-place" data-options='{
                             closed:true,
                             "title": "技术等级",
                              "width": "550px",
                              "height": "370px",
                              "nowrap": false,
                              "singleSelect": true,
                              "onClickRow":onClickRow1
                            }' >
                    <thead>
                        <tr>
                            <th data-options="field:'Beginmp',editor:'numberbox',width:120,align:'center',formatter:_css.formatStake">起点桩号</th>
                            <th data-options="field:'Endmp',editor:'numberbox',width:120,align:'center',formatter:_css.formatStake">终点桩号</th>
                            <th data-options="field:'Value',width:260,align:'center', 
                                formatter:function(value,row)
                                {                                    
                                    if(!isNaN(value))
                                    {
                                        return formatEnum(Number(value));
                                    }
                                    else
                                        return value;
						        },
						        editor:
                                {
							        type:'combobox',
							        options:
                                    {
                                        prompt:'技术等级',
                                        valueField:'id',
                                        textField:'text',
                                        url: '/api/data/roadclass',
                                        method:'get',
                                        onSelect:function(rect) {
                                            if(editIndex ==undefined)return;

                                            _standards.R210.data[editIndex].Value = rect.id;
                                        },
                                        onLoadSuccess:function(rows) {
                                            if(editIndex ==undefined)return;

                                            var row = $('#R210').datagrid('getRows')[editIndex];
                                            if (row && row.id) {
                                                $(this).combobox('setValue', row.id);
                                            }
                                        }
							        }
                                } ">技术等级</th>
                        </tr>
                    </thead>
        </table>   
        <table id="R211" class="easyui-datagrid content-place" data-options='{
                             closed:true,
                             "title": "是否全幅",
                              "width": "550px",
                              "height": "370px",
                              "nowrap": false,
                              "singleSelect": true,
                              "onClickRow":onClickRow1
                            }' >
                    <thead>
                        <tr>
                            <th data-options="field:'Beginmp',editor:'numberbox',width:120,align:'center',formatter:_css.formatStake">起点桩号</th>
                            <th data-options="field:'Endmp',editor:'numberbox',width:120,align:'center',formatter:_css.formatStake">终点桩号</th>
                            <th data-options="field:'Value',width:260,align:'center',
						        editor:
                                {
							        type:'combobox',
							        options:
                                    {
                                        prompt:'是否全幅',
                                        valueField:'id',
                                        textField:'text',
                                        data: [{
			                                text: '全幅',
			                                id: '全幅'
		                                },{
			                                text: '上下行',
			                                id: '上下行'
		                                }],
                                        onSelect:function(rect) {
                                            if(editIndex ==undefined)return;

                                            _standards.R211.data[editIndex].Value = rect.id;
                                        },
                                        onLoadSuccess:function(rows) {
                                            if(editIndex ==undefined)return;

                                            var row = $('#R211').datagrid('getRows')[editIndex];
                                            if (row) {
                                                $(this).combobox('setValue', row.id);
                                            }
                                        }
							        }
                                } ">是否全幅</th>
                        </tr>
                    </thead>
        </table>   
    </div>         
      
    <table id="dg" class="easyui-datagrid content-place"  data-ajaxcached="false"  data-options='{
                  "title": "设定路线划分标准",
                  "toolbar": "#tb",
                  "method": "get",
                  "iconCls": "icon-edit",
                  "width": "auto",
                  "height": "auto",
                  "nowrap": false,
                  "striped": true,
                  "border": true,
                  "collapsible": false,
                  "fit": false,
                  "singleSelect": true,
                  "rownumbers": true,
                  "pagination": true,
                  "onClickCell": onClickCell
                }' >
        <thead>
            <tr>
                <th data-options="field:'Rdwayid',editor:'text',width:80,align:'center'">路线编号</th>
                <th data-options="field:'Name',editor:'text',width:160,align:'center' ">路线名称</th>
                <th data-options="field:'Direction_Dictid',editor:'numberbox',width:80,align:'center',formatter:formatEnum,hidden:true ">行车方向</th>
                <th data-options="field:'R202',editor:'numberbox',width:80,align:'center' ">行政区域</th>
                <th data-options="field:'R203',editor:'numberbox',width:80,align:'center' ">管养单位</th>
                <%--<th data-options="field:'R200',editor:'numberbox',width:80,align:'center' ">路面结构</th>--%>
                <th data-options="field:'R204',editor:'numberbox',width:80,align:'center' ">车道数</th>
                <th data-options="field:'R205',editor:'numberbox',width:80,align:'center'">路面宽度</th>
                <th data-options="field:'R206',editor:'numberbox',width:80,align:'center'">土基类型</th>
                <th data-options="field:'R207',editor:'numberbox',width:80,align:'center'">交通量</th>
                <th data-options="field:'R208',editor:'numberbox',width:80,align:'center'">路肩类型</th>
                <th data-options="field:'R209',editor:'numberbox',width:80,align:'center'">通车时间</th>
                <th data-options="field:'R210',editor:'numberbox',width:80,align:'center'">技术等级</th>
                <th data-options="field:'R211',editor:'numberbox',width:80,align:'center'">是否全幅</th>
                <%--<th data-options="field:'R201',editor:'numberbox',width:80,align:'center'">构造物</th>--%>
            </tr>
        </thead>
    </table>

     <!--导入数据-->
    <div id="dlgImport" class="easyui-dialog" title="导入数据" style="width: 400px; height: 250px; padding: 10px" closed="true" data-options="
				iconCls: 'icon-save',
				buttons: '#dlg-buttonsImport'
			">      
            <table>
                <tr>
                    <td style="width:80px;">导入源:</td>
                    <td>
                        
                        <input id="fileHid" type="hidden" />
                        <input type="file" id="file1" name="file" style="width: 200px"/>
                        <a href="javascript:void(0)" id="linkUpload"  onclick="javascript:upLoad();">上传</a>
                    </td>
                </tr>               
            </table>
       
    </div>
    <!--导入数据命令-->
    <div id="dlg-buttonsImport">
        <a id="btnUpload" href="javascript:void(0)" class="easyui-linkbutton" >确定</a>
        <a id="btnQuit" href="javascript:void(0)" class="easyui-linkbutton" >取消</a>
    </div>
</asp:Content>
 